<?php
require_once("include.php");
(isset($_REQUEST["table"])) ? $table = $_REQUEST["table"] : $table = "NULL" ;
if ($table != "NULL") {
   $dblink=getconn();
   $result = mysqli_query($dblink,"select * from $table where 1=0");
   if (!$result) {terminal_error("Missing table $table");};
   $metadata = mysqli_fetch_fields($result);
   mysqli_close($dblink);
  echo "<pre>";
	
	foreach ($metadata as $id=>$rec) {
	 echo $id.' '.$rec->name."\n";
	}
}
?>
<form>
 <input type=text value="" name=table>
</form>